﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

using XCode;
using BingZi.HY.Core;
using XCode.DataAccessLayer;
using XCode.Configuration;
using BingZi.WebControls;


namespace BingZi.HY.Core
{
    /// <summary>分类信息</summary>
    [Serializable]
    [DataObject]
    [Description("分类信息")]
    [BindIndex("PK_Category_1", true, "CategoryID")]
    [BindTable("app_Category", Description = "分类信息", ConnName = "Center")]
    public partial class app_Category<TEntity> : Iapp_Category, IDropDownTree
    {
        #region 属性
        private Int32 _CategoryID =0;
        /// <summary>分类ID号</summary>
        [DisplayName("分类ID号")]
        [Description("分类ID号")]
        [DataObjectField(true, true, false, 10)]
        [BindColumn(1, "CategoryID", "分类ID号", null, "int", 10, 0, false)]
        public Int32 CategoryID
        {
            get { return _CategoryID; }
            set { if (OnPropertyChanging("CategoryID", value)) { _CategoryID = value; OnPropertyChanged("CategoryID"); } }
        }

        private String _C_Name = String.Empty;
        /// <summary>分类名</summary>
        [DisplayName("分类名")]
        [Description("分类名")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn(2, "C_Name", "分类名", null, "nvarchar(50)", 0, 0, true)]
        public String C_Name
        {
            get { return _C_Name; }
            set { if (OnPropertyChanging("C_Name", value)) { _C_Name = value; OnPropertyChanged("C_Name"); } }
        }

        private String _C_Pinyin = String.Empty;
        /// <summary>分类拼音名</summary>
        [DisplayName("分类拼音名")]
        [Description("分类拼音名")]
        [DataObjectField(false, false, false, 100)]
        [BindColumn(3, "C_Pinyin", "分类拼音名", "", "varchar(100)", 0, 0, false)]
        public String C_Pinyin
        {
            get { return _C_Pinyin; }
            set { if (OnPropertyChanging("C_Pinyin", value)) { _C_Pinyin = value; OnPropertyChanged("C_Pinyin"); } }
        }

        private Int32 _C_ParentID = 0;
        /// <summary>上级分类</summary>
        [DisplayName("上级分类")]
        [Description("上级分类")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(4, "C_ParentID", "上级分类", "0", "int", 10, 0, false)]
        public Int32 C_ParentID
        {
            get { return _C_ParentID; }
            set { if (OnPropertyChanging("C_ParentID", value)) { _C_ParentID = value; OnPropertyChanged("C_ParentID"); } }
        }

        private Int32 _C_ShowOrder = 0;
        /// <summary>显示顺序</summary>
        [DisplayName("显示顺序")]
        [Description("显示顺序")]
        [DataObjectField(false, false, false, 10)]
        [BindColumn(5, "C_ShowOrder", "显示顺序", "0", "int", 10, 0, false)]
        public Int32 C_ShowOrder
        {
            get { return _C_ShowOrder; }
            set { if (OnPropertyChanging("C_ShowOrder", value)) { _C_ShowOrder = value; OnPropertyChanged("C_ShowOrder"); } }
        }

        private Int32 _C_Level = 0;
        /// <summary>当前分类所在层数</summary>
        [DisplayName("当前分类所在层数")]
        [Description("当前分类所在层数")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn(6, "C_Level", "当前分类所在层数", "0", "int", 10, 0, false)]
        public Int32 C_Level
        {
            get { return _C_Level; }
            set { if (OnPropertyChanging("C_Level", value)) { _C_Level = value; OnPropertyChanged("C_Level"); } }
        }

        private Int32 _C_ChildCount = 0;
        /// <summary>当前分类子分类数</summary>
        [DisplayName("当前分类子分类数")]
        [Description("当前分类子分类数")]
        [DataObjectField(false, false, true, 10)]
        [BindColumn(7, "C_ChildCount", "当前分类子分类数", "0", "int", 10, 0, false)]
        public Int32 C_ChildCount
        {
            get { return _C_ChildCount; }
            set { if (OnPropertyChanging("C_ChildCount", value)) { _C_ChildCount = value; OnPropertyChanged("C_ChildCount"); } }
        }

        private String _C_Attribute = String.Empty;
        /// <summary>分类属性(json)</summary>
        [DisplayName("分类属性(json)")]
        [Description("分类属性(json)")]
        [DataObjectField(false, false, true, -1)]
        [BindColumn(8, "C_Attribute", "分类属性(json)", "", "ntext", 0, 0, false)]
        public String C_Attribute
        {
            get { return _C_Attribute; }
            set { if (OnPropertyChanging("C_Attribute", value)) { _C_Attribute = value; OnPropertyChanged("C_Attribute"); } }
        }

        private String _C_Keyword = String.Empty;
        /// <summary>关键字</summary>
        [DisplayName("关键字")]
        [Description("关键字")]
        [DataObjectField(false, false, true, 100)]
        [BindColumn(9, "C_Keyword", "关键字", "", "nvarchar(100)", 0, 0, true)]
        public String C_Keyword
        {
            get { return _C_Keyword; }
            set { if (OnPropertyChanging("C_Keyword", value)) { _C_Keyword = value; OnPropertyChanged("C_Keyword"); } }
        }

        private String _C_Description = String.Empty;
        /// <summary>分类描述</summary>
        [DisplayName("分类描述")]
        [Description("分类描述")]
        [DataObjectField(false, false, true, 200)]
        [BindColumn(10, "C_Description", "分类描述", "", "nvarchar(200)", 0, 0, true)]
        public String C_Description
        {
            get { return _C_Description; }
            set { if (OnPropertyChanging("C_Description", value)) { _C_Description = value; OnPropertyChanged("C_Description"); } }
        }

        private Int32 _C_State = (Int32)BingZi.HY.Core.EnumState.NoAudit;
        /// <summary>状态(0:未审;1:正常;2:锁定;3:删除)</summary>
        [DisplayName("状态(0:未审;1:正常;2:锁定;3:删除)")]
        [Description("状态(0:未审;1:正常;2:锁定;3:删除)")]
        [DataObjectField(false, false, false, 3)]
        [BindColumn(11, "C_State", "状态(0:未审;1:正常;2:锁定;3:删除)", "0", "tinyint", 3, 0, false)]
        public Int32 C_State
        {
            get { return _C_State; }
            set { if (OnPropertyChanging("C_State", value)) { _C_State = value; OnPropertyChanged("C_State"); } }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case "CategoryID": return _CategoryID;
                    case "C_Name": return _C_Name;
                    case "C_Pinyin": return _C_Pinyin;
                    case "C_ParentID": return _C_ParentID;
                    case "C_ShowOrder": return _C_ShowOrder;
                    case "C_Level": return _C_Level;
                    case "C_ChildCount": return _C_ChildCount;
                    case "C_Attribute": return _C_Attribute;
                    case "C_Keyword": return _C_Keyword;
                    case "C_Description": return _C_Description;
                    case "C_State": return _C_State;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case "CategoryID": _CategoryID = Convert.ToInt32(value); break;
                    case "C_Name": _C_Name = Convert.ToString(value); break;
                    case "C_Pinyin": _C_Pinyin = Convert.ToString(value); break;
                    case "C_ParentID": _C_ParentID = Convert.ToInt32(value); break;
                    case "C_ShowOrder": _C_ShowOrder = Convert.ToInt32(value); break;
                    case "C_Level": _C_Level = Convert.ToInt32(value); break;
                    case "C_ChildCount": _C_ChildCount = Convert.ToInt32(value); break;
                    case "C_Attribute": _C_Attribute = Convert.ToString(value); break;
                    case "C_Keyword": _C_Keyword = Convert.ToString(value); break;
                    case "C_Description": _C_Description = Convert.ToString(value); break;
                    case "C_State": _C_State = Convert.ToInt32(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得分类信息字段信息的快捷方式</summary>
        public class _
        {
            ///<summary>分类ID号</summary>
            public static readonly FieldItem CategoryID = Meta.Table.FindByName("CategoryID");

            ///<summary>分类名</summary>
            public static readonly FieldItem C_Name = Meta.Table.FindByName("C_Name");

            ///<summary>分类拼音名</summary>
            public static readonly FieldItem C_Pinyin = Meta.Table.FindByName("C_Pinyin");

            ///<summary>上级分类</summary>
            public static readonly FieldItem C_ParentID = Meta.Table.FindByName("C_ParentID");

            ///<summary>显示顺序</summary>
            public static readonly FieldItem C_ShowOrder = Meta.Table.FindByName("C_ShowOrder");

            ///<summary>当前分类所在层数</summary>
            public static readonly FieldItem C_Level = Meta.Table.FindByName("C_Level");

            ///<summary>当前分类子分类数</summary>
            public static readonly FieldItem C_ChildCount = Meta.Table.FindByName("C_ChildCount");

            ///<summary>分类属性(json)</summary>
            public static readonly FieldItem C_Attribute = Meta.Table.FindByName("C_Attribute");

            ///<summary>关键字</summary>
            public static readonly FieldItem C_Keyword = Meta.Table.FindByName("C_Keyword");

            ///<summary>分类描述</summary>
            public static readonly FieldItem C_Description = Meta.Table.FindByName("C_Description");

            ///<summary>状态(0:未审;1:正常;2:锁定;3:删除)</summary>
            public static readonly FieldItem C_State = Meta.Table.FindByName("C_State");
        }
        #endregion
    }

    /// <summary>分类信息接口</summary>
    public partial interface Iapp_Category
    {
        #region 属性
        /// <summary>分类ID号</summary>
        Int32 CategoryID { get; set; }

        /// <summary>分类名</summary>
        String C_Name { get; set; }

        /// <summary>分类拼音名</summary>
        String C_Pinyin { get; set; }

        /// <summary>上级分类</summary>
        Int32 C_ParentID { get; set; }

        /// <summary>显示顺序</summary>
        Int32 C_ShowOrder { get; set; }

        /// <summary>当前分类所在层数</summary>
        Int32 C_Level { get; set; }

        /// <summary>当前分类子分类数</summary>
        Int32 C_ChildCount { get; set; }

        /// <summary>分类属性(json)</summary>
        String C_Attribute { get; set; }

        /// <summary>关键字</summary>
        String C_Keyword { get; set; }

        /// <summary>分类描述</summary>
        String C_Description { get; set; }

        /// <summary>状态(0:未审;1:正常;2:锁定;3:删除)</summary>
        Int32 C_State { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}